package com.icinfo.cloud.provider.punish.api.service.impl;

import com.icinfo.cloud.provider.common.enums.ApiVisitDataSourceEnum;
import com.icinfo.cloud.provider.peripheralinterface.xfjdzf.service.IXfjdzfInterfaceService;
import com.icinfo.cloud.provider.punish.api.dto.ApiSimpleCaseDetailInfoCallbackDto;
import com.icinfo.cloud.provider.punish.api.service.IApiSimpleCaseDetailInfoCallbackService;
import com.icinfo.framework.common.web.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 描述：简易处罚详情信息数据回流接口实现类
 *
 * @author xiangyuyu
 * @date 2022/8/15
 * @since 1.3.2
 */
@Service
@Slf4j
public class ApiSimpleCaseDetailInfoCallbackServiceImpl implements IApiSimpleCaseDetailInfoCallbackService {
    @Resource
    private IXfjdzfInterfaceService iXfjdzfInterfaceService;

    /**
     * 【V1.3.2】描述：简易处罚信息回流
     *
     * @param dto {@link ApiSimpleCaseDetailInfoCallbackDto}
     * @return Result<String> 回流结果
     * @author xiangyuyu
     * @date 2022/8/11
     * @since 1.3.2
     */
    @Override
    public Result<String> callbackSimpleCaseDetailInfo(ApiSimpleCaseDetailInfoCallbackDto dto) {
        String dataSource = dto.getDataSource();
        if (ApiVisitDataSourceEnum.ZJSXFJDZFXT_MOBILE.getId().equals(dataSource)) {
            return iXfjdzfInterfaceService.callbackSimpleCaseDetailInfo(dto);
        } else {
            return Result.error("未配置数据回流机制");
        }
    }
}
